/*
 * Copyright (c) 2022 Huawei Device Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef OLA_CLOUD_TOKEN_H
#define OLA_CLOUD_TOKEN_H

#ifdef __cplusplus
extern "C" {
#endif

/*
 * 功能: 设置 cloud access token
 * 参数：accessToken，写入token
 * 返回: 0，设置成功
 *       非0，设置失败
 */
int CloudSetAccessToken(const char *accessToken);

/*
 * 功能: 获取 cloud access token
 * 返回: NULL，无有效 access token
 *       非NULL，有效 access token
 */
char *CloudGetAccessToken(void);

/*
 * 功能: 设置 cloud refresh token
 * 参数：refreshToken，写入token
 * 返回: 0，设置成功
 *       非0，设置失败
 */
int CloudSetRefreshToken(const char *refreshToken);

/*
 * 功能: 获取 cloud refresh token
 * 返回: NULL，无有效 refresh token
 *       非NULL，有效 refresh token
 */
char *CloudGetRefreshToken(void);

/*
 * 功能: 设置access token 失效时间
 * 参数：expireTime，失效时间 单位：ms
 */
void CloudSetTokenExpireTime(unsigned long long expireTime);

/*
 * 功能: 获取access token 失效时间
 * 返回: 失效时间 单位：ms
 */
unsigned long long CloudGetTokenExpireTime(void);

#ifdef __cplusplus
}
#endif

#endif /* OLA_CLOUD_TOKEN_H */
